package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;

import android.os.Bundle;
import android.util.Log;
import android.widget.LinearLayout;

import java.util.ArrayList;

public class ExerciseActivity extends AppCompatActivity {

    private Fragment fragment;
    private String chinese, answer;
    private ArrayList<String> english;
    private int times;
    private ArrayList<Integer> results;

    public ExerciseActivity() {
        this.chinese = "弹跳";
        english = new ArrayList<>();
        this.english.add("bounce");
        this.english.add("longevity");
        this.english.add("dimension");
        this.english.add("sulfur");
        answer = "bounce";
        times = 0;
        results = new ArrayList<>();
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_exercise);
        Bundle bundle = getIntent().getExtras();
        String title = bundle.getString("title");
        setTitle(title);
        Log.d("hha", "onCreate: setTitle " + title);

        fragment = ExerciseFragment.newInstance(chinese, english, answer, times, results);
        getSupportFragmentManager().beginTransaction().add(R.id.ll_container, fragment).commitAllowingStateLoss();
    }
}